package com.sunwayhorizo.health.hl7.rim;

import com.sunwayhorizo.health.hl7.common.*;
import com.sunwayhorizo.health.hl7.datatypes.*;
import com.sunwayhorizo.health.hl7.factories.*;
import com.sunwayhorizo.health.hl7.persistent.*;
import java.io.*;
import javax.persistence.*;
import static com.sunwayhorizo.health.hl7.vocabulary.EntityCdSetCode.*;

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorValue("CONT")
public class Container extends ManufacturedMaterial implements Serializable
{

    /**
     * 
     */
    protected static final long serialVersionUID = 1L;


    /*
     * public PQ BarrierDeltaQuantity; public PQ BottomDeltaQuantity; public CE
     * CapTypeCode; public PQ CapacityQuantity; public PQ DiameterQuantity;
     * public PQ HeightQuantity; public CE SeparatorTypeCode;
     */
    public Container() throws Hl7Exception
    {
    }


    public Container(ReferenceModifier referencemodifier)
    {
        super(referencemodifier);
    }


    public void setBarrierDeltaQuantity(PQ BarrierDeltaQuantity)
    {
        if(BarrierDeltaQuantity == null) return;
        this.setCtBarrierDeltaQtyTxt(BarrierDeltaQuantity.value().literal().toString());
        this.setCtBarrierDeltaQtyUomCode(BarrierDeltaQuantity.unit().code().toString());
    }


    public PQ getBarrierDeltaQuantity() throws Hl7Exception
    {
        return DataTypeUtil.getPQ(this.getCtBarrierDeltaQtyTxt(), this.getCtBarrierDeltaQtyUomCode());
    }


    public void setBottomDeltaQuantity(PQ BottomDeltaQuantity)
    {
        if(BottomDeltaQuantity == null) return;
        this.setCtBottomDeltaQtyTxt(BottomDeltaQuantity.value().literal().toString());
        this.setCtBottomDeltaQtyUomCode(BottomDeltaQuantity.unit().code().toString());
    }


    public PQ getBottomDeltaQuantity() throws Hl7Exception
    {
        return DataTypeUtil.getPQ(this.getCtBottomDeltaQtyTxt(), this.getCtBottomDeltaQtyUomCode());
    }

    //设置盖子类型编码
    public void setCapTypeCode(CE ce)
    {
        if (null != ce && ce.codeSystemEnName() != null && ce.codeName() != null)
        {
            setRimCoreEntyCdSets(ce, CAPTYPECODE);
        }
        else
        {
            if(StrUtil.isNotEmpty(ce.code().toString()) && !ce.code().toString().equals("<Null:NullFlavor: NI>"))
            {
                this.setCtCapTypeCodeEtsId(ce.code().toString());
            }
        }
    }

    //获取盖子类型编码
    public CE getCapTypeCode() throws Hl7Exception
    {
        if (this.getCtCapTypeCodeEtsId().equals(CAPTYPECODE.toString()))
        {
            for (RimCoreEntyCdSets entityCdSets : this.getEntyCdSetsList())
            {
                if (this.getCtCapTypeCodeEtsId().equals(entityCdSets.getAttributeTypeCode()))
                {
                    return DataTypeUtil.getCE(entityCdSets);
                }
            }
        }
        else
            return DataTypeUtil.getCE(this.getCtCapTypeCodeEtsId());
        return null;
    }


    public void setCapacityQuantity(PQ CapacityQuantity)
    {
        if(CapacityQuantity == null) return;
        this.setCtCapacityQtyTxt(CapacityQuantity.value().literal().toString());
        this.setCtCapacityQtyUomCode((CapacityQuantity.unit().code().toString().equals("<Null:NullFlavor: NI>") ? "" : CapacityQuantity.unit().code().toString()));
        
    }


    public PQ getCapacityQuantity() throws Hl7Exception
    {
        return DataTypeUtil.getPQ(this.getCtCapacityQtyTxt(), this.getCtCapacityQtyUomCode());
    }


    public void setDiameterQuantity(PQ DiameterQuantity)
    {
        if(DiameterQuantity == null) return;
        this.setCtDiameterQtyTxt(DiameterQuantity.value().literal().toString());
        this.setCtDiameterQtyUomCode(DiameterQuantity.unit().code().toString());
    }


    public PQ getDiameterQuantity() throws Hl7Exception
    {
        return DataTypeUtil.getPQ(this.getCtDiameterQtyTxt(), this.getCtDiameterQtyUomCode());
    }


    public void setHeightQuantity(PQ HeightQuantity)
    {
        if(HeightQuantity == null) return;
        this.setCtHeightQtyTxt(HeightQuantity.value().literal().toString());
        this.setCtHeightQtyUomCode(HeightQuantity.unit().code().toString());
    }


    public PQ getHeightQuantity() throws Hl7Exception
    {
        return DataTypeUtil.getPQ(this.getCtHeightQtyTxt(), this.getCtHeightQtyUomCode());
    }


    public void setSeparatorTypeCode(CE ce)
    {
        if (null != ce && ce.codeSystemEnName() != null && ce.codeName() != null)
        {
            setRimCoreEntyCdSets(ce, SEPARATORTYPECODE);
        }
        else
        {
            if(StrUtil.isNotEmpty(ce.code().toString()) && !ce.code().toString().equals("<Null:NullFlavor: NI>"))
            {
                this.setCtSeparatorTypeCodeEtsId(ce.code().toString());
            }
        }
    }


    public CE getSeparatorTypeCode() throws Hl7Exception
    {
        if (this.getCtSeparatorTypeCodeEtsId().equals(SEPARATORTYPECODE.toString()))
        {
            for (RimCoreEntyCdSets entityCdSets : this.getEntyCdSetsList())
            {
                if (this.getCtSeparatorTypeCodeEtsId().equals(entityCdSets.getAttributeTypeCode()))
                {
                    return DataTypeUtil.getCE(entityCdSets);
                }
            }
        }
        else
            return DataTypeUtil.getCE(this.getCtSeparatorTypeCodeEtsId());
        return null;
    }

    // Container ������
    @Column(name = "CT_CAPACITY_QTY_TXT")
    protected String ctCapacityQtyTxt;
    @Column(name = "CT_CAPACITY_QTY_UOM_CODE")
    protected String ctCapacityQtyUomCode;
    @Column(name = "CT_HEIGHT_QTY_TXT")
    protected String ctHeightQtyTxt;
    @Column(name = "CT_HEIGHT_QTY_UOM_CODE")
    protected String ctHeightQtyUomCode;
    @Column(name = "CT_DIAMETER_QTY_TXT")
    protected String ctDiameterQtyTxt;
    @Column(name = "CT_DIAMETER_QTY_UOM_CODE")
    protected String ctDiameterQtyUomCode;
    @Column(name = "CT_CAP_TYPE_CODE_ETS_ID")
    protected String ctCapTypeCodeEtsId = CAPTYPECODE.toString();
    @Column(name = "CT_SEPARATOR_TYPE_CODE_ETS_ID")
    protected String ctSeparatorTypeCodeEtsId =SEPARATORTYPECODE.toString();
    @Column(name = "CT_BARRIER_DELTA_QTY_TXT")
    protected String ctBarrierDeltaQtyTxt;
    @Column(name = "CT_BARRIER_DELTA_QTY_UOM_CODE")
    protected String ctBarrierDeltaQtyUomCode;
    @Column(name = "CT_BOTTOM_DELTA_QTY_TXT")
    protected String ctBottomDeltaQtyTxt;
    @Column(name = "CT_BOTTOM_DELTA_QTY_UOM_CODE")
    protected String ctBottomDeltaQtyUomCode;


    protected void setCtCapacityQtyTxt(String ctCapacityQtyTxt)
    {
        this.ctCapacityQtyTxt = ctCapacityQtyTxt;
    }


    protected String getCtCapacityQtyTxt()
    {
        return ctCapacityQtyTxt;
    }


    protected void setCtCapacityQtyUomCode(String ctCapacityQtyUomCode)
    {
        this.ctCapacityQtyUomCode = ctCapacityQtyUomCode;
    }


    protected String getCtCapacityQtyUomCode()
    {
        return ctCapacityQtyUomCode;
    }


    protected void setCtHeightQtyTxt(String ctHeightQtyTxt)
    {
        this.ctHeightQtyTxt = ctHeightQtyTxt;
    }


    protected String getCtHeightQtyTxt()
    {
        return ctHeightQtyTxt;
    }


    protected void setCtHeightQtyUomCode(String ctHeightQtyUomCode)
    {
        this.ctHeightQtyUomCode = ctHeightQtyUomCode;
    }


    protected String getCtHeightQtyUomCode()
    {
        return ctHeightQtyUomCode;
    }


    protected void setCtDiameterQtyTxt(String ctDiameterQtyTxt)
    {
        this.ctDiameterQtyTxt = ctDiameterQtyTxt;
    }


    protected String getCtDiameterQtyTxt()
    {
        return ctDiameterQtyTxt;
    }


    protected void setCtDiameterQtyUomCode(String ctDiameterQtyUomCode)
    {
        this.ctDiameterQtyUomCode = ctDiameterQtyUomCode;
    }


    protected String getCtDiameterQtyUomCode()
    {
        return ctDiameterQtyUomCode;
    }


    protected void setCtCapTypeCodeEtsId(String ctCapTypeCodeEtsId)
    {
        this.ctCapTypeCodeEtsId = ctCapTypeCodeEtsId;
    }


    protected String getCtCapTypeCodeEtsId()
    {
        return ctCapTypeCodeEtsId;
    }


    protected void setCtSeparatorTypeCodeEtsId(String ctSeparatorTypeCodeEtsId)
    {
        this.ctSeparatorTypeCodeEtsId = ctSeparatorTypeCodeEtsId;
    }


    protected String getCtSeparatorTypeCodeEtsId()
    {
        return ctSeparatorTypeCodeEtsId;
    }


    protected void setCtBarrierDeltaQtyTxt(String ctBarrierDeltaQtyTxt)
    {
        this.ctBarrierDeltaQtyTxt = ctBarrierDeltaQtyTxt;
    }


    protected String getCtBarrierDeltaQtyTxt()
    {
        return ctBarrierDeltaQtyTxt;
    }


    protected void setCtBarrierDeltaQtyUomCode(String ctBarrierDeltaQtyUomCode)
    {
        this.ctBarrierDeltaQtyUomCode = ctBarrierDeltaQtyUomCode;
    }


    protected String getCtBarrierDeltaQtyUomCode()
    {
        return ctBarrierDeltaQtyUomCode;
    }


    protected void setCtBottomDeltaQtyTxt(String ctBottomDeltaQtyTxt)
    {
        this.ctBottomDeltaQtyTxt = ctBottomDeltaQtyTxt;
    }


    protected String getCtBottomDeltaQtyTxt()
    {
        return ctBottomDeltaQtyTxt;
    }


    protected void setCtBottomDeltaQtyUomCode(String ctBottomDeltaQtyUomCode)
    {
        this.ctBottomDeltaQtyUomCode = ctBottomDeltaQtyUomCode;
    }


    protected String getCtBottomDeltaQtyUomCode()
    {
        return ctBottomDeltaQtyUomCode;
    }

}
